package File;

import java.io.*;

/**
 * @author wuhan
 * @date 2019/10/13 17:00
 */


public class DataStreamDemo {
    public static void main(String[] args) throws IOException {
//        writeData();
//        readData();
        writeUTFDemo();
    }
    public static void writeData() throws IOException {
        DataOutputStream dos=new DataOutputStream(new FileOutputStream("data.txt"));
        dos.writeInt(2);
        dos.writeBoolean(true);
        dos.writeDouble(12312.123123);
        dos.close();
    }
    public static void readData() throws IOException{
        DataInputStream dis=new DataInputStream(new FileInputStream("data.txt"));
        int i = dis.readInt();
        boolean b = dis.readBoolean();
        double v = dis.readDouble();
        System.out.println(i);
        System.out.println(b);
        System.out.println(v);
        dis.close();
    }
    public static void writeUTFDemo() throws IOException {
        DataOutputStream dos=new DataOutputStream(new FileOutputStream("utf.txt"));
        dos.writeUTF("吴焓");
        dos.close();
    }
}
